3.248 \(\int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx\)

Optimal. Leaf size=76 \[ \frac {b \tanh ^{-1}(\sin (e+f x))}{d f}-\frac {2 (b c-a d) \tanh ^{-1}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{d f \sqrt {c-d} \sqrt {c+d}} \]

[Out]

b*arctanh(sin(f*x+e))/d/f-2*(-a*d+b*c)*arctanh((c-d)^(1/2)*tan(1/2*e+1/2*f*x)/(c+d)^(1/2))/d/f/(c-d)^(1/2)/(c+
d)^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.13, antiderivative size = 76, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {3998, 3770, 3831, 2659, 208} \[ \frac {b \tanh ^{-1}(\sin (e+f x))}{d f}-\frac {2 (b c-a d) \tanh ^{-1}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{d f \sqrt {c-d} \sqrt {c+d}} \]

Antiderivative was successfully verified.

[In]

Int[(Sec[e + f*x]*(a + b*Sec[e + f*x]))/(c + d*Sec[e + f*x]),x]

[Out]

(b*ArcTanh[Sin[e + f*x]])/(d*f) - (2*(b*c - a*d)*ArcTanh[(Sqrt[c - d]*Tan[(e + f*x)/2])/Sqrt[c + d]])/(Sqrt[c
- d]*d*Sqrt[c + d]*f)

Rule 208

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-(a/b), 2]*ArcTanh[x/Rt[-(a/b), 2]])/a, x] /; FreeQ[{a,
b}, x] && NegQ[a/b]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3831

Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[1/b, Int[1/(1 + (a*Sin[e
 + f*x])/b), x], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 - b^2, 0]

Rule 3998

Int[(csc[(e_.) + (f_.)*(x_)]*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)))/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x
_Symbol] :> Dist[B/b, Int[Csc[e + f*x], x], x] + Dist[(A*b - a*B)/b, Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x]
, x] /; FreeQ[{a, b, e, f, A, B}, x] && NeQ[A*b - a*B, 0]

Rubi steps

\begin {align*} \int \frac {\sec (e+f x) (a+b \sec (e+f x))}{c+d \sec (e+f x)} \, dx &=\frac {b \int \sec (e+f x) \, dx}{d}+\frac {(-b c+a d) \int \frac {\sec (e+f x)}{c+d \sec (e+f x)} \, dx}{d}\\ &=\frac {b \tanh ^{-1}(\sin (e+f x))}{d f}-\frac {(b c-a d) \int \frac {1}{1+\frac {c \cos (e+f x)}{d}} \, dx}{d^2}\\ &=\frac {b \tanh ^{-1}(\sin (e+f x))}{d f}-\frac {(2 (b c-a d)) \operatorname {Subst}\left (\int \frac {1}{1+\frac {c}{d}+\left (1-\frac {c}{d}\right ) x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{d^2 f}\\ &=\frac {b \tanh ^{-1}(\sin (e+f x))}{d f}-\frac {2 (b c-a d) \tanh ^{-1}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{\sqrt {c-d} d \sqrt {c+d} f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.21, size = 112, normalized size = 1.47 \[ \frac {\frac {2 (b c-a d) \tanh ^{-1}\left (\frac {(d-c) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{\sqrt {c^2-d^2}}+b \left (\log \left (\sin \left (\frac {1}{2} (e+f x)\right )+\cos \left (\frac {1}{2} (e+f x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )\right )}{d f} \]

Antiderivative was successfully verified.

[In]

Integrate[(Sec[e + f*x]*(a + b*Sec[e + f*x]))/(c + d*Sec[e + f*x]),x]

[Out]

((2*(b*c - a*d)*ArcTanh[((-c + d)*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/Sqrt[c^2 - d^2] + b*(-Log[Cos[(e + f*x)/
2] - Sin[(e + f*x)/2]] + Log[Cos[(e + f*x)/2] + Sin[(e + f*x)/2]]))/(d*f)

________________________________________________________________________________________

fricas [A]  time = 1.08, size = 316, normalized size = 4.16 \[ \left [-\frac {{\left (b c - a d\right )} \sqrt {c^{2} - d^{2}} \log \left (\frac {2 \, c d \cos \left (f x + e\right ) - {\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} + 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right ) - {\left (b c^{2} - b d^{2}\right )} \log \left (\sin \left (f x + e\right ) + 1\right ) + {\left (b c^{2} - b d^{2}\right )} \log \left (-\sin \left (f x + e\right ) + 1\right )}{2 \, {\left (c^{2} d - d^{3}\right )} f}, -\frac {2 \, {\left (b c - a d\right )} \sqrt {-c^{2} + d^{2}} \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right ) - {\left (b c^{2} - b d^{2}\right )} \log \left (\sin \left (f x + e\right ) + 1\right ) + {\left (b c^{2} - b d^{2}\right )} \log \left (-\sin \left (f x + e\right ) + 1\right )}{2 \, {\left (c^{2} d - d^{3}\right )} f}\right ] \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="fricas")

[Out]

[-1/2*((b*c - a*d)*sqrt(c^2 - d^2)*log((2*c*d*cos(f*x + e) - (c^2 - 2*d^2)*cos(f*x + e)^2 + 2*sqrt(c^2 - d^2)*
(d*cos(f*x + e) + c)*sin(f*x + e) + 2*c^2 - d^2)/(c^2*cos(f*x + e)^2 + 2*c*d*cos(f*x + e) + d^2)) - (b*c^2 - b
*d^2)*log(sin(f*x + e) + 1) + (b*c^2 - b*d^2)*log(-sin(f*x + e) + 1))/((c^2*d - d^3)*f), -1/2*(2*(b*c - a*d)*s
qrt(-c^2 + d^2)*arctan(-sqrt(-c^2 + d^2)*(d*cos(f*x + e) + c)/((c^2 - d^2)*sin(f*x + e))) - (b*c^2 - b*d^2)*lo
g(sin(f*x + e) + 1) + (b*c^2 - b*d^2)*log(-sin(f*x + e) + 1))/((c^2*d - d^3)*f)]

________________________________________________________________________________________

giac [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotImplementedError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="giac")

[Out]

Exception raised: NotImplementedError >> Unable to parse Giac output: Unable to check sign: (4*pi/x/2)>(-4*pi/
x/2)Unable to check sign: (4*pi/x/2)>(-4*pi/x/2)2/f*(-b*1/2/d*ln(abs(tan((f*x+exp(1))/2)-1))+b*1/2/d*ln(abs(ta
n((f*x+exp(1))/2)+1))+(-2*a*d+2*c*b)/d*1/2/sqrt(-c^2+d^2)*(atan((c*tan((f*x+exp(1))/2)-d*tan((f*x+exp(1))/2))/
sqrt(-c^2+d^2))+pi*sign(2*c-2*d)*floor((f*x+exp(1))/2/pi+1/2)))

________________________________________________________________________________________

maple [A]  time = 0.59, size = 135, normalized size = 1.78 \[ \frac {2 a \arctanh \left (\frac {\tan \left (\frac {e}{2}+\frac {f x}{2}\right ) \left (c -d \right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{f \sqrt {\left (c +d \right ) \left (c -d \right )}}-\frac {2 \arctanh \left (\frac {\tan \left (\frac {e}{2}+\frac {f x}{2}\right ) \left (c -d \right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right ) c b}{f d \sqrt {\left (c +d \right ) \left (c -d \right )}}-\frac {b \ln \left (\tan \left (\frac {e}{2}+\frac {f x}{2}\right )-1\right )}{f d}+\frac {b \ln \left (\tan \left (\frac {e}{2}+\frac {f x}{2}\right )+1\right )}{f d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x)

[Out]

2/f*a/((c+d)*(c-d))^(1/2)*arctanh(tan(1/2*e+1/2*f*x)*(c-d)/((c+d)*(c-d))^(1/2))-2/f/d/((c+d)*(c-d))^(1/2)*arct
anh(tan(1/2*e+1/2*f*x)*(c-d)/((c+d)*(c-d))^(1/2))*c*b-1/f/d*b*ln(tan(1/2*e+1/2*f*x)-1)+1/f/d*b*ln(tan(1/2*e+1/
2*f*x)+1)

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*c^2-4*d^2>0)', see `assume?`
 for more details)Is 4*c^2-4*d^2 positive or negative?

________________________________________________________________________________________

mupad [B]  time = 2.73, size = 573, normalized size = 7.54 \[ \frac {a\,c^2\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}-\frac {a\,d^2\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}-\frac {2\,b\,d\,\mathrm {atanh}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,\left (c^2-d^2\right )}-\frac {a\,\ln \left (\frac {c\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {\left (c+d\right )\,\left (c-d\right )}}{f\,\left (c^2-d^2\right )}+\frac {b\,c\,d\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{f\,{\left (c^2-d^2\right )}^{3/2}}+\frac {2\,b\,c^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d\,f\,\left (c^2-d^2\right )}-\frac {b\,c^3\,\ln \left (\frac {c\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )-d\,\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )+\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )}{d\,f\,{\left (c^2-d^2\right )}^{3/2}}+\frac {b\,c\,\ln \left (\frac {c\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )+d\,\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )-\sin \left (\frac {e}{2}+\frac {f\,x}{2}\right )\,\sqrt {c^2-d^2}}{\cos \left (\frac {e}{2}+\frac {f\,x}{2}\right )}\right )\,\sqrt {\left (c+d\right )\,\left (c-d\right )}}{d\,f\,\left (c^2-d^2\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b/cos(e + f*x))/(cos(e + f*x)*(c + d/cos(e + f*x))),x)

[Out]

(a*c^2*log((c*sin(e/2 + (f*x)/2) - d*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(c^2 - d^2)^(1/2))/cos(e/2 + (f*x
)/2)))/(f*(c^2 - d^2)^(3/2)) - (a*d^2*log((c*sin(e/2 + (f*x)/2) - d*sin(e/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(c
^2 - d^2)^(1/2))/cos(e/2 + (f*x)/2)))/(f*(c^2 - d^2)^(3/2)) - (2*b*d*atanh(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/
2)))/(f*(c^2 - d^2)) - (a*log((c*cos(e/2 + (f*x)/2) + d*cos(e/2 + (f*x)/2) - sin(e/2 + (f*x)/2)*(c^2 - d^2)^(1
/2))/cos(e/2 + (f*x)/2))*((c + d)*(c - d))^(1/2))/(f*(c^2 - d^2)) + (b*c*d*log((c*sin(e/2 + (f*x)/2) - d*sin(e
/2 + (f*x)/2) + cos(e/2 + (f*x)/2)*(c^2 - d^2)^(1/2))/cos(e/2 + (f*x)/2)))/(f*(c^2 - d^2)^(3/2)) + (2*b*c^2*at
anh(sin(e/2 + (f*x)/2)/cos(e/2 + (f*x)/2)))/(d*f*(c^2 - d^2)) - (b*c^3*log((c*sin(e/2 + (f*x)/2) - d*sin(e/2 +
 (f*x)/2) + cos(e/2 + (f*x)/2)*(c^2 - d^2)^(1/2))/cos(e/2 + (f*x)/2)))/(d*f*(c^2 - d^2)^(3/2)) + (b*c*log((c*c
os(e/2 + (f*x)/2) + d*cos(e/2 + (f*x)/2) - sin(e/2 + (f*x)/2)*(c^2 - d^2)^(1/2))/cos(e/2 + (f*x)/2))*((c + d)*
(c - d))^(1/2))/(d*f*(c^2 - d^2))

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {\left (a + b \sec {\left (e + f x \right )}\right ) \sec {\left (e + f x \right )}}{c + d \sec {\left (e + f x \right )}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sec(f*x+e)*(a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x)

[Out]

Integral((a + b*sec(e + f*x))*sec(e + f*x)/(c + d*sec(e + f*x)), x)

________________________________________________________________________________________